import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'home_controller.dart';

 class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  State<HomePage> createState() => _HomePageState();

}

class _HomePageState extends State<HomePage> {
  final logic = Get.find<HomeController>();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Home')),
      // body: GetBuilder<HomeController>(builder: (controller) {
      // return 
      body:Center(
        child: Obx(
        () => Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
                   Obx(() =>
            Text('Count: ${logic.count}', style: TextStyle(fontSize: 24))),
              // Text("${SR.hello.tr} : ${state.count}", style: TextStyle(fontSize: 50.sp),),
              ElevatedButton(onPressed: () => logic.getVersion(), child: const Text("请求")),
              ElevatedButton(onPressed: () => logic.getVersions(), child: const Text("retrofit请求")),
                  ElevatedButton( onPressed: logic.makeGetRequest,  child: Text('Make GET Request'), ),
              Text("信息：${logic.versionData.value?.toJson()}", style: TextStyle(fontSize: 20.sp)),
            ],
            ),
          )),
      floatingActionButton: FloatingActionButton(
        onPressed: logic.increment,
        child: Icon(Icons.add),
      ),
    );
  }
}
